﻿@model List<int>
@*@Html.ListBoxFor(model => model, (IEnumerable<SelectListItem>)ViewData["SelectList"])
<script>
        $(document).ready(function () {
            $("#@ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty)").kendoAutoComplete({
                select: function (e) {
                    var current = this.value();

                    if (this.dataSource.view()[e.item.index()].value === "0") {
                        this.value("");
                    }
                    else if (current.indexOf("0") !== -1) {
                        current = $.grep(current, function (value) {
                            return value !== "0";
                        });

                        this.value(current);
                    }
                },
                change: function (e) {
                    if (this.value().length === 0)
                        this.value(["0"]);
                }
            }).data("kendoAutoComplete");
        });
    //没弄好
    </script>*@
<input id="countries" />
<script type="text/javascript">
    $(document).ready(function () {
        var data = [
            "Albania",
            "Andorra",
            "Armenia",
            "Austria",
            "Azerbaijan",
            "Belarus",
            "Belgium",
            "Vatican City"
        ];//定义数据
        $("#countries").kendoAutoComplete({
            dataSource: data,//绑定数据源
            filter: "startswith",//过滤规则
            placeholder: "Select country...",//占位字符
            //separator: ", " //分割符
        });
    });
</script>  